package com.yc.algorithm;

/**
 * Title: 字符串<br>
 * Description: <br>
 * Author:陈圆(chenyuan@bosssoft.com.cn) <br>
 * Date:2020/8/17
 */
public class StringOperate {

    public static void main(String[] args) {
        StringOperate stringOperate = new StringOperate();
        System.out.printf("反转后的字符串：%s\n", stringOperate.reverseStr("sdf"));
    }

    /***
     * 字符串的反转，递归方式
     * @param sourStr
     * @return java.lang.String
     */
    public String reverseStr(String sourStr) {
        if (null == sourStr || sourStr.length() <= 1) {
            return sourStr;
        }

        return reverseStr(sourStr.substring(1)) + sourStr.charAt(0);
    }


}
